<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>对称二叉树</title>
</head>
<body>
  <script>
    function fn(root) {
      if (root == null) {
        return true;
      }
      return dfs(root.left, root.right)
    }
    const dfs = function (Left, Right) {
      if (Left == null && Right == null) {
        return true;
      }
      if (Left == null || Right == null || Left.val !== Right.val) {
        return false;
      }
      return dfs(Left.left, Right.right) && dfs(Left.right, Right.left)
    }
    console.log(fn([1, 2, 2, 3, 4, 4, 3]))
  </script>
</body>
</html>